Conversation
| # limitations under the License. | ||
|
|
||
| """Support for keyword-only fields in dataclasses for Python versions <3.10. | ||
| """This module is kept for backward compatibility. |
There was a problem hiding this comment.
praxis is using flax/linen/kw_only_dataclasses.py module here: https://github.com/google/praxis/blob/main/praxis/base_hyperparams.py#L36
| v2 = Child(4, a=5) # pylint: disable=too-many-function-args | ||
| self.assertDictEqual(dataclasses.asdict(v2), dict(a=5, b=4)) | ||
|
|
||
| @absltest.expectedFailureIf(True, "non-default argument 'size' follows default argument") |
There was a problem hiding this comment.
This test is failing with built-in python dataclasses:
class B inherits from A where a default kwarg is defined, thus B can't define non-default size attribute.
| self.assertEqual( | ||
| list(Test2.__dataclass_fields__.keys()), | ||
| ['bar', 'baz', 'parent', 'name'], | ||
| set(Test2.__dataclass_fields__.keys()), |
There was a problem hiding this comment.
Test adaptation is needed with built-in python dataclasses vs linen.kw_only_dataclasses
aa49caa to
5fd3b57
Compare
4be43de to
3eeb377
Compare
|
Here is a repro for the problem we see with this internally. It's kind of wild and I don't know what's going on here: I ran this under Python 3.12. With the changes in this CL, I get: |
|
I still don't know why this works, but adding: right before the: call seems to work around the problem. For some reason, |
|
@hawkinsp thanks a lot for investigations! |
|
Another note: for praxis I found that adding |
|
Reported the bug on cpython: python/cpython#141681 |
917ca90 to
1014b25
Compare
1014b25 to
964f503
Compare
964f503 to
b43ade8
Compare
|
This PR is the only thing blocking me from upgrading to Python 3.14... Any chance it could get some love? |
b43ade8 to
67f596e
Compare
|
TODO:
|
|
What is blocking this one from merge? Can we do something to help? We're already at python 3.14.2, and we missed one flax release. Tensorstore has added python 3.14 support a couple weeks ago too. (sorry for the double-post, not sure if the copybara PRs are being monitored by anyone). |
|
Most probably this PR #5135 will land to add python 3.14 support. |
|
Fixed in dd15749 . |
|
Woohoo! Thank you for working on this! Can't wait to upgrade my project to Python 3.14. |
Fixes #5027
fieldanddataclasslinked to python built-in dataclasseskw_only_dataclassesin linen module.py